<!-- 拼车接天府 -->
<template>
    <div style=" position: relative;">
        <div>

            <el-tabs v-model="tabs_activeName" class="demo-tabs" @tab-click="handleClick">
                <el-tab-pane label="未接到" name="未接到">
                    <!-- 搜索 -->
                    <div>
                        <!-- <el-select style="width:160px" v-model="find_data.routeSimpleName" placeholder="请选择行程简称"
                                >
                                <el-option v-for="item in routeSimpleName_list" :key="item.value" :label="item.label"
                                    :value="item.value" />
                            </el-select> -->
                        <el-date-picker :default-time="defaultTime" style="width: 340px;" v-model="timeTypeTime"
                            @change="timeTypeTime_btn" type="datetimerange" start-placeholder="开始时间"
                            end-placeholder="结束时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />

                        <el-input style="width: 180px;margin-left: 20px;" v-model="find_data.details"
                            placeholder="订单详情搜索" clearable prefix-icon="Search" />
                        <el-input style="width: 160px;margin-left: 20px;" v-model="find_data.orderNum"
                            placeholder="订单编号" clearable prefix-icon="Search" />
                        <el-button style="margin-left: 20px;height:30px" @click="search_btn" type="primary"
                            icon="Search">搜索</el-button>
                        <el-button style="margin-left: 20px;height:30px" @click="yijiedao_btn" type="warning"
                            icon="Select">已接到</el-button>
                        <el-button @click="up_btn" type="warning" icon="WarnTriangleFilled">修改</el-button>
                        <el-button @click="del_btn" type="danger" icon="CircleCloseFilled">删除订单</el-button>
                        <div style='margin-top:10px'>
                            <el-table border @header-dragend='headerdragend' @selection-change="selection_change_btn"
                                height="60vh" ref="multipleTableRef" :data="weijiedao_list" style="width: 100%">
                                <el-table-column type="selection" width="35" />
                                <el-table-column label="编号" width="55" fixed type="index" />

                                <template v-for="item in table_data_list_new" :key="item.field">
                                    <el-table-column v-if="item.off && item.off3" :width="item.width" :prop="item.field"
                                        :label="item.label">
                                        <template v-if="item.field == 'status'" #="{ row, column, $index }">
                                            <span>
                                                未接到

                                            </span>
                                            <div
                                                v-if='row.orderSource != "WX_MP_CARTEAM" && row.orderSource != "PC_CAR_TEAM" && row.isUseTeamPriceTemplates == "0" && row.isReceiveByTeam == "0" && row.type != "2"'>
                                                <el-button @click="receiveOrRefuse_btn(row)" type="danger"
                                                    size="small">确认/拒绝</el-button>
                                            </div>
                                        </template>


                                        <template v-if="item.field == 'routeSimpleName'" #="{ row, column, $index }">
                                            <span v-if="row.isTrusteeOrder == 1">
                                                <el-button circle type="danger" size="small">托</el-button>
                                            </span>
                                            <span
                                                :style="row.routeSimpleName.includes('接') ? 'color:#36954e' : 'color:red;'">{{
                                                    row.routeSimpleName }}</span>
                                        </template>

                                        <template v-if="item.field == 'needSeats'" #="{ row, column, $index }">
                                            <span>{{ row.needSeats ? row.needSeats + '座' : '不限车型' }}</span>
                                        </template>

                                        <template v-if="item.field == 'driverName'" #="{ row, column, $index }">
                                            <span>{{ row.driverName ? row.driverName + '' + row.driverPhone : ''
                                                }}</span>
                                        </template>

                                        <template v-if="item.field == 'startDate'" #="{ row, column, $index }">
                                            <span>{{ row.startTime.split(' ')[0] }}</span>
                                        </template>

                                        <template v-if="item.field == 'startTime'" #="{ row, column, $index }">
                                            <span>{{ row.startTime.split(' ')[1] }}</span>
                                        </template>

                                        <template v-if="item.field == 'endDate'" #="{ row, column, $index }">
                                            <span>{{ row.endTime.split(' ')[0] }}</span>
                                        </template>

                                        <template v-if="item.field == 'endTime'" #="{ row, column, $index }">
                                            <span>{{ row.endTime.split(' ')[1] }}</span>
                                        </template>

                                        <template v-if="item.field == 'cusName'" #="{ row, column, $index }">
                                            <span>{{ row.cusInfo }}</span>
                                        </template>

                                        <!-- <template v-if="item.field == 'shareName'" #="{ row, column, $index }">
                                            <span>{{ row.cusNam?row.cusName:'' }}-{{ row.shareMobile }}</span>
                                        </template> -->
                                        <template v-if="item.field == 'persons'" #="{ row, column, $index }">
                                            <span>{{
                                                row.serviceMan ? row.serviceMan.split('-')[1] + '-' +
                                                    row.serviceMan.split('-')[2]
                                                    : '' }}</span>
                                        </template>
                                        <template v-if="item.field == 'isMerge'" #="{ row, column, $index }">
                                            <span>{{ row.isMerge == true ? '合并' : '未合并' }}</span>
                                        </template>
                                    </el-table-column>

                                </template>
                                <el-table-column fixed="right" label="操作" width="180">
                                    <template #default="{ row, column, $index }">
                                        <div v-if="row.mergeId">
                                            <!-- v-if='!row.mergeId' -->
                                            <el-button type="danger" size="small"
                                                @click="no_release_btn(row)">取消发布</el-button>
                                            <!-- <el-button type="warning" size="small" @click="no_hebing_Btn(row)">取消合并</el-button> -->
                                        </div>
                                        <div v-else>
                                            <el-button type="primary" size="small"
                                                @click="release_btn(row)">发布</el-button>
                                            <el-button v-if='row.index_off' type="warning" size="small"
                                                @click="hebing_Btn(row)">合并订单</el-button>

                                        </div>


                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>

                        <div style="margin-top:20px">
                            <el-pagination @current-change="current_change_btn" @size-change="size_change_btn"
                                v-model:current-page="find_data.page.pageNum"
                                v-model:page-size="find_data.page.pageSize" :page-sizes="[100, 200, 300, 500, 1000]"
                                :background="true" layout="prev, pager, next, jumper,->,sizes,total," :total="total" />
                        </div>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="已接到" name="已接到">
                    <!-- 搜索 -->
                    <div>
                        <!-- <el-select style="width:160px" v-model="find_data.routeSimpleName" placeholder="请选择行程简称"
                                >
                                <el-option v-for="item in routeSimpleName_list" :key="item.value" :label="item.label"
                                    :value="item.value" />
                            </el-select> -->
                        <el-date-picker :default-time="defaultTime" style="width: 340px;" v-model="timeTypeTime"
                            @change="timeTypeTime_btn" type="datetimerange" start-placeholder="开始时间"
                            end-placeholder="结束时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />
                        <el-input style="width: 180px;margin-left: 20px;" v-model="find_data.details"
                            placeholder="订单详情搜索" clearable prefix-icon="Search" />
                        <el-input style="width: 160px;margin-left: 20px;" v-model="find_data.orderNum"
                            placeholder="订单编号" clearable prefix-icon="Search" />
                        <el-button style="margin-left: 20px;height:30px" @click="search_btn" type="primary"
                            icon="Search">搜索</el-button>
                        <el-button @click="up_btn" type="warning" icon="WarnTriangleFilled">修改</el-button>
                        <el-button @click="del_btn" type="danger" icon="CircleCloseFilled">删除订单</el-button>
                        <!-- <el-button style="margin-left: 20px;height:30px" @click="yijiedao_btn" type="warning"
                                icon="Select">已接到</el-button> -->
                        <div style='margin-top:10px'>
                            <el-table border @selection-change="selection_change_btn2" height="60vh"
                                ref="multipleTableRef" :data="yijiedao_list" style="width: 100%">
                                <el-table-column type="selection" width="35" />
                                <el-table-column label="编号" width="55" fixed type="index" />

                                <template v-for="item in table_data_list_new" :key="item.field">
                                    <el-table-column v-if="item.off && item.off2" :width="item.width" :prop="item.field"
                                        :label="item.label">
                                        <template v-if="item.field == 'status'" #="{ row, column, $index }">
                                            <span>
                                                已接到

                                            </span>

                                        </template>


                                        <template v-if="item.field == 'routeSimpleName'" #="{ row, column, $index }">
                                            <span
                                                :style="row.routeSimpleName.includes('接') ? 'color:#36954e' : 'color:red;'">{{
                                                    row.routeSimpleName }}</span>
                                        </template>

                                        <template v-if="item.field == 'needSeats'" #="{ row, column, $index }">
                                            <span>{{ row.needSeats ? row.needSeats + '座' : '不限车型' }}</span>
                                        </template>

                                        <template v-if="item.field == 'driverName'" #="{ row, column, $index }">
                                            <span>{{ row.driverName ? row.driverName + '' + row.driverPhone : ''
                                                }}</span>
                                        </template>

                                        <template v-if="item.field == 'startDate'" #="{ row, column, $index }">
                                            <span>{{ row.startTime.split(' ')[0] }}</span>
                                        </template>

                                        <template v-if="item.field == 'startTime'" #="{ row, column, $index }">
                                            <span>{{ row.startTime.split(' ')[1] }}</span>
                                        </template>

                                        <template v-if="item.field == 'endDate'" #="{ row, column, $index }">
                                            <span>{{ row.endTime.split(' ')[0] }}</span>
                                        </template>

                                        <template v-if="item.field == 'endTime'" #="{ row, column, $index }">
                                            <span>{{ row.endTime.split(' ')[1] }}</span>
                                        </template>

                                        <template v-if="item.field == 'cusName'" #="{ row, column, $index }">
                                            <span>{{ row.cusInfo }}</span>
                                        </template>
                                        <template v-if="item.field == 'persons'" #="{ row, column, $index }">
                                            <span>{{
                                                row.serviceMan ? row.serviceMan.split('-')[1] + '-' +
                                                    row.serviceMan.split('-')[2]
                                                    : '' }}</span>
                                        </template>

                                        <!-- <template v-if="item.field == 'shareName'" #="{ row, column, $index }">
                                                <span>{{ row.shareName }}-{{ row.shareMobile }}</span>
                                            </template> -->

                                        <template v-if="item.field == 'isMerge'" #="{ row, column, $index }">
                                            <span>{{ row.isMerge == true ? '合并' : '未合并' }}</span>
                                        </template>

                                        <template v-if="item.field == 'useCarCompanyId'" #="{ row, column, $index }">
                                            <!-- row.realName ? row.realName  : -->
                                            <!-- <span>{{
                                    row.useCarCompanyName ? row.useCarCompanyName : row.mobile
                                }}{{ row.mobile ? '-' + row.mobile : '' }}</span> -->
                                            <span>{{ useCarCompanyId_data_api(row) }}</span>
                                        </template>

                                        <template v-if="item.field == 'useCarDutyInfo'" #="{ row, column, $index }">
                                            <!-- <span>{{
                                    row.useCarDutyInfo ? row.useCarDutyInfo.split('-').length > 2 ? row.useCarDutyInfo.split('-')[1] + '-' + row.useCarDutyInfo.split('-')[2] : row.useCarDutyInfo.split('-')[0] + '-' + row.useCarDutyInfo.split('-')[1]
                                        : '' }}</span> -->
                                            <span>{{ useCarDutyInfo_data_api(row) }}</span>
                                        </template>
                                    </el-table-column>
                                </template>
                                <el-table-column fixed="right" label="操作" width="180">
                                    <template #default="{ row, column, $index }">
                                        <div v-if="row.mergeId">
                                            <!-- v-if='!row.mergeId' -->
                                            <el-button type="danger" size="small"
                                                @click="no_release_btn(row)">取消发布</el-button>
                                            <!-- <el-button type="warning" size="small" @click="no_hebing_Btn(row)">取消合并</el-button> -->
                                        </div>
                                        <div v-else>
                                            <el-button type="primary" size="small"
                                                @click="vehicles_btn(row)">派车</el-button>
                                            <el-button v-if='row.index_off' type="warning" size="small"
                                                @click="hebing_Btn(row)">合并订单</el-button>

                                        </div>


                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>

                        <div style="margin-top:20px">
                            <el-pagination @current-change="current_change_btn" @size-change="size_change_btn"
                                v-model:current-page="find_data.page.pageNum"
                                v-model:page-size="find_data.page.pageSize" :page-sizes="[100, 200, 300, 500, 1000]"
                                :background="true" layout="prev, pager, next, jumper,->,sizes,total," :total="total" />
                        </div>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="已派车" name="已派车">
                    <!-- 搜索 -->
                    <div>
                        <!-- <el-select style="width:160px" v-model="find_data.routeSimpleName" placeholder="请选择行程简称"
                                >
                                <el-option v-for="item in routeSimpleName_list" :key="item.value" :label="item.label"
                                    :value="item.value" />
                            </el-select> -->
                        <el-date-picker :default-time="defaultTime" style="width: 340px;" v-model="timeTypeTime"
                            @change="timeTypeTime_btn" type="datetimerange" start-placeholder="开始时间"
                            end-placeholder="结束时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />

                        <el-input style="width: 180px;margin-left: 20px;" v-model="find_data.details"
                            placeholder="订单详情搜索" clearable prefix-icon="Search" />
                        <el-input style="width: 160px;margin-left: 20px;" v-model="find_data.orderNum"
                            placeholder="订单编号" clearable prefix-icon="Search" />
                        <el-button style="margin-left: 20px;height:30px" @click="search_btn" type="primary"
                            icon="Search">搜索</el-button>
                        <el-button @click="up_btn" type="warning" icon="WarnTriangleFilled">修改</el-button>
                        <el-button @click="del_btn" type="danger" icon="CircleCloseFilled">删除订单</el-button>
                        <!-- <el-button style="margin-left: 20px;height:30px" @click="yijiedao_btn" type="warning"
                                icon="Select">已接到</el-button> -->
                        <div style='margin-top:10px'>
                            <el-table border @selection-change="selection_change_btn3" height="60vh"
                                ref="multipleTableRef" :data="yipaiche_list" style="width: 100%">
                                <el-table-column type="selection" width="35" />
                                <el-table-column label="编号" width="55" fixed type="index" />

                                <template v-for="item in table_data_list_new" :key="item.field">
                                    <el-table-column v-if="item.off" :width="item.width" :prop="item.field"
                                        :label="item.label">
                                        <template v-if="item.field == 'status'" #="{ row, column, $index }">
                                            <span>
                                                已接到

                                            </span>

                                        </template>


                                        <template v-if="item.field == 'routeSimpleName'" #="{ row, column, $index }">
                                            <span
                                                :style="row.routeSimpleName.includes('接') ? 'color:#36954e' : 'color:red;'">{{
                                                    row.routeSimpleName }}</span>
                                        </template>

                                        <template v-if="item.field == 'needSeats'" #="{ row, column, $index }">
                                            <span>{{ row.needSeats ? row.needSeats + '座' : '不限车型' }}</span>
                                        </template>



                                        <template v-if="item.field == 'plateNum'" #="{ row, column, $index }">
                                            <span>{{ row.plateNum }}</span>
                                            <div v-if="row.plateNum">
                                                <el-button @click="up_car(row)" type="primary"
                                                    size="small">修改车辆</el-button>

                                            </div>
                                        </template>

                                        <template v-if="item.field == 'driverName'" #="{ row, column, $index }">
                                            <span>{{ row.driverName ? row.driverName + '-' + row.driverPhone : ''
                                                }}</span>
                                            <div v-if="row.plateNum">
                                                <el-button @click="up_driverName(row)" type="primary"
                                                    size="small">修改驾驶员</el-button>

                                            </div>
                                        </template>

                                        <template v-if="item.field == 'startDate'" #="{ row, column, $index }">
                                            <span>{{ row.startTime.split(' ')[0] }}</span>
                                        </template>

                                        <template v-if="item.field == 'startTime'" #="{ row, column, $index }">
                                            <span>{{ row.startTime.split(' ')[1] }}</span>
                                        </template>

                                        <template v-if="item.field == 'endDate'" #="{ row, column, $index }">
                                            <span>{{ row.endTime.split(' ')[0] }}</span>
                                        </template>

                                        <template v-if="item.field == 'endTime'" #="{ row, column, $index }">
                                            <span>{{ row.endTime.split(' ')[1] }}</span>
                                        </template>

                                        <template v-if="item.field == 'cusName'" #="{ row, column, $index }">
                                            <span>{{ row.cusInfo }}</span>
                                        </template>

                                        <!-- <template v-if="item.field == 'shareName'" #="{ row, column, $index }">
                                                <span>{{ row.shareName }}-{{ row.shareMobile }}</span>
                                            </template> -->
                                        <template v-if="item.field == 'persons'" #="{ row, column, $index }">
                                            <span>{{
                                                row.serviceMan ? row.serviceMan.split('-')[1] + '-' +
                                                    row.serviceMan.split('-')[2]
                                                    : '' }}</span>
                                        </template>
                                        <template v-if="item.field == 'isMerge'" #="{ row, column, $index }">
                                            <span>{{ row.isMerge == true ? '合并' : '未合并' }}</span>
                                        </template>
                                    </el-table-column>
                                </template>

                            </el-table>
                        </div>

                        <div style="margin-top:20px">
                            <el-pagination @current-change="current_change_btn" @size-change="size_change_btn"
                                v-model:current-page="find_data.page.pageNum"
                                v-model:page-size="find_data.page.pageSize" :page-sizes="[100, 200, 300, 500, 1000]"
                                :background="true" layout="prev, pager, next, jumper,->,sizes,total," :total="total" />
                        </div>
                    </div>
                </el-tab-pane>
            </el-tabs>
        </div>



    </div>

    <!-- 弹窗 -->
    <div>

        <!-- 表格筛选 -->
        <div style="position: absolute;top:62px;z-index: 9999;" :style="icon_off ? 'right:0px;' : 'right:110px;'">
            <el-icon @click="icon_btn" :size="20">
                <Setting />
            </el-icon>
            <div v-show="icon_off"
                style=" position: relative;top:-100px;right:140px;width: 130px;height:430px;background:#fff;overflow: hidden;">
                <div class="cols-set" style="background:#fff;width:90%;height:97%;margin:auto;margin-top:10px;">
                    <div>
                        <el-button-group style="display: flex; ">
                            <el-tooltip effect="dark" placement="bottom">
                                <template #content>注意：拖动下面的项，可以改变表格列的顺序，<br />记得点击保存才会永久生效哦！ </template>
                                <el-button style="width:10px" type="primary" icon="WarningFilled"></el-button>
                            </el-tooltip>
                            <el-button title="重置" type="primary" icon="Refresh" @click="resetTableSet"></el-button>
                            <el-button title="保存" type="primary" icon="Check" @click="saveTableSet"></el-button>
                        </el-button-group>
                        <div ref="sortableContainer" class="col-items" style="height:400px; overflow-y: auto; ">
                            <el-checkbox class="drag_it" @change="checkbox_btn" v-for="item in sortedItems"
                                :key="item.field" v-model="item.off" :label="item.label" border>
                            </el-checkbox>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <!-- 合并订单 -->
        <!-- <el-dialog style="margin-top:5vh" v-model="hebing_off" title="合并派车" width="80%" :close-on-click-modal='false'>
            <div>
                <div style="display:flex;margin-bottom:20px;font-weight:700">
                    <b>{{ hebing_obj.routeSimpleName }}</b>
                    <el-divider direction="vertical"></el-divider>
                    <b>{{ hebing_obj.startTime }}</b>
                    <el-divider direction="vertical"></el-divider>
                    <b>{{ hebing_obj.endTime }}</b>
                    <el-divider direction="vertical"></el-divider>
                    <el-tooltip effect="dark" :content="hebing_obj.details" placement="bottom">
                        <b class="sl route-detail-text">{{ hebing_obj.details }}</b>
                    </el-tooltip>
                    <el-divider direction="vertical"></el-divider>
                    <b>{{ hebing_obj.personNum }}人</b>
                    <el-divider direction="vertical"></el-divider>
                    <b>{{ hebing_obj.needSeats ? hebing_obj.needSeats + '座' : '不限车型' }}</b>
                </div>

                <template v-if="set_list">
                    <div v-for="item in set_list"
                        style="display:flex;margin-bottom:20px;font-weight:700;align-items: center;">
                        <b>{{ item.routeSimpleName }}</b>
                        <el-divider direction="vertical"></el-divider>
                        <b>{{ item.startTime }}</b>
                        <el-divider direction="vertical"></el-divider>
                        <b>{{ item.endTime }}</b>
                        <el-divider direction="vertical"></el-divider>
                        <el-tooltip effect="dark" :content="item.details" placement="bottom">
                            <b class="sl route-detail-text">{{ item.details }}</b>
                        </el-tooltip>
                        <el-divider direction="vertical"></el-divider>
                        <b>{{ item.personNum }}人</b>
                        <el-divider direction="vertical"></el-divider>
                        <b>{{ item.needSeats ? item.needSeats + '座' : '不限车型' }}</b>
                        <el-button style="margin-left:10px" size="small" type="danger"
                            @click="set_over_btn(item)">删除</el-button>
                    </div>
                </template>
                <el-divider class="seled-order-line"><b style="color:blue;">订单</b></el-divider>


                <el-table @selection-change="filterOrder_selection_change_btn" :data="hebing_list" border fit
                    :height="350" style="width: 100%;margin-bottom: 20px;">


                    <el-table-column label="编号" width="55" fixed type="index" />
                    <el-table-column width="120" property="set" label="操作">

                        <template #default="scope">
                            <el-button size="small" type="primary" @click="set_btn(scope.row)">确认选择</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column width="120" property="routeSimpleName" label="行程简称" />
                    <el-table-column width="220" label="驾驶员">

                        <template #="{ row, column, $index }">
                            <div v-if="row.plateNum">{{ row.plateNum }}（{{ row.driverName + '-' +
                row.driverPhone
                                }}）</div>
                            <div v-else></div>
                        </template>

                    </el-table-column>
                    <el-table-column width="170" property="startTime" label="出发时间" />
                    <el-table-column property="fromLocation" label="出发地点" />
                    <el-table-column property="toLocation" label="结束地点" />
                    <el-table-column width="170" property="endTime" label="结束时间" />
                    <el-table-column width="120" property="lastDetails" label="人数">

                        <template #="{ row, column, $index }">
                            {{ row.personNum }}(人)
                        </template>
                    </el-table-column>
                 
                    <el-table-column width="120" property="remark" label="备注" />


                </el-table>
                <el-divider class="seled-order-line"><b style="color:rgb(255, 0, 55);">派车</b></el-divider>
                <el-form class="form_Css" :inline="true">
                    <el-form-item>
                        <div style="font-weight:700">筛选车辆:</div>
                    </el-form-item>

                    <el-form-item>
                        <el-input v-model="hebing_car_data.seats" placeholder="座位数">

                            <template #append>座</template>
                        </el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-select clearable v-model="hebing_car_data.plateNum" :placeholder="'车牌号'"
                            style="width: 120px">
                            <el-option v-for="item in carNumList" :key="item.id" :label="item.plate_num"
                                :value="item.plate_num"></el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item>
                        <el-select v-model="hebing_car_data.driverUserIdIsNull" :placeholder="'是否有驾驶员'"
                            style="width: 120px">
                            <el-option :label="'没有驾驶员'" value="0"></el-option>
                            <el-option :label="'有驾驶员'" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-select v-model="hebing_car_data.fastCondition" :placeholder="'重叠时间'" style="width: 120px">
                            <el-option :label="'月佣金(工资)升序'" value="0"></el-option>
                            <el-option :label="'评分最高降序'" value="1"></el-option>
                            <el-option :label="'最快达到'" value="2"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="hebing_car_api" type="primary">搜索</el-button>
                    </el-form-item>
                </el-form>
                <el-table :data="hebing_car_list" border fit :height="350" style="width: 100%;margin-bottom: 20px;">

                    <el-table-column label="编号" width="55" fixed type="index" />
                    <el-table-column width="140" property="plateNum" label="车牌号">

                        <template #="{ row, column, $index }">
                            {{ row.plateNum }} <span v-if="row.isRestricted" style="color:Red">(限号)</span><br>
                            <el-button @click="hebing_car_data_ok_btn(row)" size="small" type="primary">派车</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column width="120" property="driverName" label="驾驶员" />
                    <el-table-column width="120" property="simpleDockedAddress" label="停靠点" />
                    <el-table-column property="lastDetails" label="上一单行程" />
                    <el-table-column width="120" property="routeTime" label="最快到达" />
                    <el-table-column width="120" property="salaryBalance" label="月佣金" />
                    <el-table-column width="120" property="customerScoring" label="评分" />
                    <el-table-column property="nextDetails" label="下一单行程" />
                    <el-table-column width="120" property="remark" label="备注" />
                </el-table>
            </div>
        </el-dialog> -->

        <el-dialog style="margin-top:5vh" v-model="hebing_Btn_off" title="合并发布" width="80%"
            :close-on-click-modal='false'>
            <div>



                <div v-for="(item, index) in hebing_Btn_data"
                    style="display:flex;margin-bottom:20px;font-weight:700;align-items: center;">
                    <b>{{ item.routeSimpleName }}</b>
                    <el-divider direction="vertical"></el-divider>
                    <b>{{ item.startTime }}</b>
                    <el-divider direction="vertical"></el-divider>
                    <b>{{ item.endTime }}</b>
                    <el-divider direction="vertical"></el-divider>
                    <el-tooltip effect="dark" :content="item.details" placement="bottom">
                        <b class="sl route-detail-text">{{ item.details }}</b>
                    </el-tooltip>
                    <el-divider direction="vertical"></el-divider>
                    <b>{{ item.personNum }}人</b>
                    <el-divider direction="vertical"></el-divider>
                    <b>{{ item.needSeats ? item.needSeats + '座' : '不限车型' }}</b>
                    <!-- <el-button  style="margin-left:10px" size="small"
                        :type="item.startTime != hebing_Btn_data_time?'primary':'success'" @click="startTime_btn(item.startTime)">{{ item.startTime }}:合并时间</el-button> -->
                    <el-button v-if="index > 0" style="margin-left:10px" size="small" type="danger"
                        @click="set_over_btn(item)">删除</el-button>

                </div>

                <el-divider class="seled-order-line"><b style="color:blue;">订单</b></el-divider>

                <el-table :data="hebing_Btn_list" border fit :height="350" style="width: 100%;margin-bottom: 20px;">


                    <el-table-column label="编号" width="55" fixed type="index" />
                    <el-table-column width="120" property="set" label="操作">

                        <template #default="scope">
                            <el-button size="small" type="primary"
                                @click="hebing_Btn_list_btn(scope.row)">确认选择</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column width="120" property="routeSimpleName" label="行程简称" />
                    <el-table-column width="220" label="驾驶员">

                        <template #="{ row, column, $index }">
                            <div v-if="row.plateNum">{{ row.plateNum }}（{{ row.driverName + '-' +
                                row.driverPhone
                                }}）</div>
                            <div v-else></div>
                        </template>

                    </el-table-column>
                    <el-table-column width="170" property="startTime" label="出发时间" />
                    <el-table-column property="fromLocation" label="出发地点" />
                    <el-table-column property="toLocation" label="结束地点" />
                    <el-table-column width="170" property="endTime" label="结束时间" />
                    <el-table-column width="120" property="lastDetails" label="人数">

                        <template #="{ row, column, $index }">
                            {{ row.personNum }}(人)
                        </template>
                    </el-table-column>
                    <el-table-column width="120" property="lastDetails" label="需求车型">

                        <template #="{ row, column, $index }">
                            {{ row.needSeats ? row.needSeats : '不限车型' }}
                        </template>
                    </el-table-column>
                    <el-table-column width="120" property="remark" label="备注" />


                </el-table>
                <div>

                    <el-button style="margin-left:90%" type="primary" @click="innerVisible_btn()">合并订单</el-button>
                </div>
            </div>
            <el-dialog v-model="innerVisible" title="合并订单时间选择:" width="30%" :close-on-click-modal='false'
                append-to-body>
                <div style="display: flex;">

                    <!-- <div v-for="(item, index) in hebing_Btn_data" :key="index">
                       
                        <el-button style="margin-left:10px" size="small"
                            :type="item.startTime != hebing_Btn_data_time ? 'primary' : 'success'"
                            @click="startTime_btn(item.startTime)">{{ item.startTime }}:合并时间</el-button>
                    </div> -->
                    <el-date-picker v-model="hebing_Btn_data_time" type="datetime" placeholder="请选择合并订单时间"
                        format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />
                    <el-input v-model="time_number1" @change='time_number_change1(1)'
                        style="width: 260px;margin-left:10px" placeholder="时间转换,格式:1201转换时间为12:01" clearable />
                </div>
                <el-button style="margin-left:85%;margin-top:10px" type="primary" @click="ok_over_btn()">确认</el-button>
            </el-dialog>

        </el-dialog>

        <!-- 派车 -->
        <el-dialog style="margin-top:5vh" v-model="vehicles_off" title="派车" width="80%" :close-on-click-modal='false'>
            <div>
                <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick2">
                    <el-tab-pane label="线上派车" name="线上派车">
                        <!-- <div style="display:flex;margin-bottom:20px;font-weight:700">
                            <b>{{ vehicles_data.routeSimpleName }}</b>
                            <el-divider direction="vertical"></el-divider>
                            <b>{{ vehicles_data.startTime }}</b>
                            <el-divider direction="vertical"></el-divider>
                            <b>{{ vehicles_data.endTime }}</b>
                            <el-divider direction="vertical"></el-divider>
                            <el-tooltip effect="dark" :content="vehicles_data.details" placement="bottom">
                                <b class="sl route-detail-text">{{ vehicles_data.details }}</b>
                            </el-tooltip>
                            <el-divider direction="vertical"></el-divider>
                            <b>{{ vehicles_data.personNum }}人</b>
                            <el-divider direction="vertical"></el-divider>
                            <b>{{ vehicles_data.needSeats ? vehicles_data.needSeats + '座' : '不限车型' }}</b>
                        </div>

                        <template v-if="set_list">
                            <div v-for="item in set_list"
                                style="display:flex;margin-bottom:20px;font-weight:700;align-items: center;">
                                <b>{{ item.routeSimpleName }}</b>
                                <el-divider direction="vertical"></el-divider>
                                <b>{{ item.startTime }}</b>
                                <el-divider direction="vertical"></el-divider>
                                <b>{{ item.endTime }}</b>
                                <el-divider direction="vertical"></el-divider>
                                <el-tooltip effect="dark" :content="item.details" placement="bottom">
                                    <b class="sl route-detail-text">{{ item.details }}</b>
                                </el-tooltip>
                                <el-divider direction="vertical"></el-divider>
                                <b>{{ item.personNum }}人</b>
                                <el-divider direction="vertical"></el-divider>
                                <b>{{ item.needSeats ? item.needSeats + '座' : '不限车型' }}</b>
                                <el-button style="margin-left:10px" size="small" type="danger"
                                    @click="set_over_btn(item)">删除</el-button>
                            </div>
                        </template>
                        <el-divider class="seled-order-line"><b style="color:blue;">订单</b></el-divider>
                        <el-form class="form_Css" :inline="true">
                            <el-form-item>
                                <div style="font-weight:700">距该订单:</div>
                            </el-form-item>
                            <el-form-item>
                                <el-radio-group @change="filterOrder_data_radio_change"
                                    v-model="filterOrder_data_radio">
                                    <el-radio :label="1">起点</el-radio>
                                    <el-radio :label="2">终点</el-radio>
                                    <el-radio :label="3">套接</el-radio>
                                </el-radio-group>

                            </el-form-item>
                            <el-form-item>
                                <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" disabled
                                    v-model="filterOrder_data.stime" type="datetime" placeholder="开始日期" />
                            </el-form-item>
                            <el-form-item>
                                <el-select @change="filterOrder_data_change" v-model="filterOrder_data.time"
                                    :placeholder="'时间'" style="width: 120px">
                                    <el-option :label="'6小时'" value="6"></el-option>
                                    <el-option :label="'12小时'" value="12"></el-option>
                                    <el-option :label="'24小时'" value="24"></el-option>
                                    <el-option :label="'48小时'" value="48"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" disabled
                                    v-model="filterOrder_data.etime" type="datetime" placeholder="结束日期" />
                            </el-form-item>
                            <el-form-item>
                                <el-radio-group v-model="filterOrder_data_radio2">
                                    <el-radio :label="4">间隔时间升序</el-radio>
                                    <el-radio :label="5">行程耗时升序</el-radio>
                                </el-radio-group>
                            </el-form-item>

                            <el-form-item>
                                <el-select v-model="filterOrder_data.avgSpeed" :placeholder="'平均速度'"
                                    style="width: 120px">
                                    <el-option :label="'25公里/小时'" value="25"></el-option>
                                    <el-option :label="'30公里/小时'" value="30"></el-option>
                                    <el-option :label="'35公里/小时'" value="35"></el-option>
                                    <el-option :label="'40公里/小时'" value="40"></el-option>
                                    <el-option :label="'45公里/小时'" value="45"></el-option>
                                    <el-option :label="'50公里/小时'" value="50"></el-option>
                                    <el-option :label="'60公里/小时'" value="60"></el-option>
                                    <el-option :label="'70公里/小时'" value="70"></el-option>
                                    <el-option :label="'80公里/小时'" value="80"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="可重叠时间：">
                                <el-select v-model="filterOrder_data.overlapTime" :placeholder="'重叠时间'"
                                    style="width: 120px">
                                    <el-option :label="'0分钟'" value="0"></el-option>
                                    <el-option :label="'5分钟'" value="5"></el-option>
                                    <el-option :label="'10分钟'" value="10"></el-option>
                                    <el-option :label="'15分钟'" value="15"></el-option>
                                    <el-option :label="'20分钟'" value="20"></el-option>
                                    <el-option :label="'25分钟'" value="25"></el-option>
                                    <el-option :label="'30分钟'" value="30"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-button style="margin-left:20px" @click="filterOrder_data_find"
                                    type="primary">搜索</el-button>
                            </el-form-item>
                        </el-form>

                        <el-table @selection-change="filterOrder_selection_change_btn" :data="filterOrder_list" border
                            fit :height="350" style="width: 100%;margin-bottom: 20px;">

                     
                            <el-table-column label="编号" width="55" fixed type="index" />
                            <el-table-column width="120" property="set" label="操作">

                                <template #default="scope">
                                    <el-button size="small" type="primary" @click="set_btn(scope.row)">确认选择</el-button>
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="routeSimpleName" label="行程简称" />
                            <el-table-column width="220" label="驾驶员">

                                <template #="{ row, column, $index }">
                                    <div v-if="row.plateNum">{{ row.plateNum }}（{{ row.driverName + '-' +
                        row.driverPhone
                                        }}）</div>
                                    <div v-else></div>
                                </template>

                            </el-table-column>
                            <el-table-column width="170" property="startTime" label="出发时间" />
                            <el-table-column property="fromLocation" label="出发地点" />
                            <el-table-column property="toLocation" label="结束地点" />
                            <el-table-column width="170" property="endTime" label="结束时间" />
                            <el-table-column width="120" property="lastDetails" label="人数">

                                <template #="{ row, column, $index }">
                                    {{ row.personNum }}(人)
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="lastDetails" label="需求车型">

                                <template #="{ row, column, $index }">
                                    {{ row.needSeats ? row.needSeats : '不限车型' }}
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="remark" label="备注" />


                        </el-table>
                        <el-divider class="seled-order-line"><b style="color:rgb(255, 0, 55);">派车</b></el-divider> -->
                        <el-form class="form_Css" :inline="true">
                            <el-form-item>
                                <div style="font-weight:700">筛选车辆:</div>
                            </el-form-item>

                            <el-form-item>
                                <el-input @change="getCarConfigurationType_btn" v-model="filterCar_data.seats"
                                    placeholder="座位数">

                                    <template #append>座</template>
                                </el-input>
                            </el-form-item>
                            <el-form-item>

                                <el-select v-model="filterCar_data.carConfig" clearable :filterable="false"
                                    placeholder="车辆配置" style="width: 360px;">
                                    <el-option v-for="item in getCarConfigurationType_list" :key="item.id"
                                        :label="item.val + '(' + item.other + ')'" :value="item.id" />

                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select clearable v-model="filterCar_data.plateNum" :placeholder="'车牌号'"
                                    style="width: 120px">
                                    <el-option v-for="item in carNumList" :key="item.id" :label="item.plate_num"
                                        :value="item.plate_num"></el-option>
                                </el-select>
                            </el-form-item>

                            <el-form-item>
                                <el-select v-model="filterCar_data.driverUserIdIsNull" :placeholder="'是否有驾驶员'"
                                    style="width: 120px">
                                    <el-option :label="'没有驾驶员'" value="0"></el-option>
                                    <el-option :label="'有驾驶员'" value="1"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select v-model="filterCar_data.fastCondition" :placeholder="'重叠时间'"
                                    style="width: 120px">
                                    <el-option :label="'月佣金(工资)升序'" value="0"></el-option>
                                    <el-option :label="'评分最高降序'" value="1"></el-option>
                                    <el-option :label="'最快达到'" value="2"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-button style="margin-left:20px" @click="filterCar_data_find"
                                    type="primary">搜索</el-button>
                            </el-form-item>
                        </el-form>
                        <el-table :data="filterCar_list" border fit :height="350"
                            style="width: 100%;margin-bottom: 20px;">

                            <el-table-column label="编号" width="55" fixed type="index" />
                            <el-table-column width="200" property="plateNum" label="车牌号">

                                <template #="{ row, column, $index }">
                                    {{ row.seats + '座-' + row.plateNum }} <span v-if="row.isRestricted"
                                        style="color:Red">(限号)</span><br>
                                    <el-button @click="filterCar_data_ok_btn(row)" size="small"
                                        type="primary">派车</el-button>
                                </template>
                            </el-table-column>
                            <el-table-column width="180" property="driverName" label="驾驶员">
                                <template #="{ row, column, $index }">
                                    {{ row.driverName + '-' + row.driverPhone }}
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="simpleDockedAddress" label="停靠点" />
                            <el-table-column property="lastDetails" label="上一单行程">
                                <template #="{ row, column, $index }">
                                    <span :style="row.lastOrderId ? 'color:red' : ''">{{ row.lastDetails }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="routeTime" label="最快到达" />
                            <el-table-column width="120" property="salaryBalance" label="月佣金" />
                            <el-table-column width="120" property="customerScoring" label="评分" />
                            <el-table-column property="nextDetails" label="下一单行程">
                                <template #="{ row, column, $index }">
                                    <span :style="row.orderId ? 'color:red' : ''">{{ row.nextDetails }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="remark" label="备注" />
                        </el-table>
                    </el-tab-pane>
                    <el-tab-pane label="线下派车" name="线下派车">
                        <div style="font-weight:700;font-size:20px;margin-bottom:20px;">
                            行程简称:{{ vehicles_data.routeSimpleName }}</div>
                        <el-form class="form_Css" :model="offlineDispatchCar_data" ref="offlineDispatchCar_ref"
                            :inline="true">
                            <el-form-item>
                                <el-select @change="carCompanyId_change" v-model="offlineDispatchCar_data.carCompanyId"
                                    :placeholder="'请选择线下车队'" style="width: 240px" filterable remote
                                    :filter-method="handleFilter">
                                    <el-option v-for="item in findComboCusList_list" :label="item.cusCompanyName"
                                        key="item.id" :value="item.id"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-input style="width: 170px;" v-model="offlineDispatchCar_data.dispatchName"
                                    placeholder="请选择业务负责人" clearable />
                            </el-form-item>
                            <el-form-item>
                                <el-input style="width: 190px;" v-model="offlineDispatchCar_data.dispatchMobile"
                                    placeholder="请选择业务负责人手机号" clearable />

                            </el-form-item>

                            <el-form-item prop="plateNum" :rules="[
                                { required: true, message: '请输入车牌号', trigger: 'blur' },

                            ]">
                                <el-input v-model="offlineDispatchCar_data.plateNum" placeholder="车牌号"
                                    style="width: 120px;"></el-input>
                            </el-form-item>

                            <el-form-item prop="driverName" :rules="[
                                { required: true, message: '请输入师傅姓名', trigger: 'blur' },

                            ]">
                                <el-input v-model="offlineDispatchCar_data.driverName" placeholder="师傅姓名"
                                    style="width: 120px;"></el-input>
                            </el-form-item>

                            <el-form-item prop="driverPhone" :rules="[
                                { required: true, message: '请输入师傅电话', trigger: 'blur' },

                            ]">
                                <el-input maxlength="11" v-model="offlineDispatchCar_data.driverPhone"
                                    placeholder="师傅电话" style="width: 180px;"></el-input>
                            </el-form-item>


                            <el-form-item prop="outPrice" :rules="[
                                { required: true, message: '请输入派单价格', trigger: 'blur' },

                            ]">
                                <el-input type="number" maxlength="6" v-model="offlineDispatchCar_data.outPrice"
                                    placeholder="派单价格" style="width: 180px;">

                                    <template #append>元</template></el-input>
                            </el-form-item>


                        </el-form>
                        <el-button style="margin-left:70vw" @click="filterCar_data_btn" type="primary">派车</el-button>
                    </el-tab-pane>

                </el-tabs>
            </div>


        </el-dialog>
        <uporder v-if="up_off" @myClick="upCarMd" :data="up_off" :id="up_id"></uporder>
        <!-- 修改线下派车 -->
        <el-dialog style="margin-top:5vh" v-model="xianxiaup_car_off" title="线下派车修改" width="80%"
            :close-on-click-modal='false'>
            <div>

                <!-- <div style="font-weight:700;font-size:20px;margin-bottom:20px;">
                  行程简称:{{ vehicles_data.routeSimpleName }}</div> -->
                <el-form class="form_Css" :model="xianxiaup_car_data" ref="offlineDispatchCar_ref" :inline="true">
                    <el-form-item>
                        <el-select @change="xianxiacarCompanyId_change" v-model="xianxiaup_car_data.carCompanyId"
                            :placeholder="'请选择线下车队'" style="width: 240px">
                            <el-option v-for="item in findComboCusList_list" :label="item.cusCompanyName" key="item.id"
                                :value="item.id"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 170px;" v-model="xianxiaup_car_data.dispatchName" placeholder="请选择业务负责人"
                            clearable />
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 190px;" v-model="xianxiaup_car_data.dispatchMobile"
                            placeholder="请选择业务负责人手机号" clearable />

                    </el-form-item>

                    <el-form-item prop="plateNum" :rules="[
                        { required: true, message: '请输入车牌号', trigger: 'blur' },

                    ]">
                        <el-input v-model="xianxiaup_car_data.plateNum" placeholder="车牌号"
                            style="width: 120px;"></el-input>
                    </el-form-item>

                    <el-form-item prop="driverName" :rules="[
                        { required: true, message: '请输入师傅姓名', trigger: 'blur' },

                    ]">
                        <el-input v-model="xianxiaup_car_data.driverName" placeholder="师傅姓名"
                            style="width: 120px;"></el-input>
                    </el-form-item>

                    <el-form-item prop="driverPhone" :rules="[
                        { required: true, message: '请输入师傅电话', trigger: 'blur' },

                    ]">
                        <el-input maxlength="11" v-model="xianxiaup_car_data.driverPhone" placeholder="师傅电话"
                            style="width: 180px;"></el-input>
                    </el-form-item>





                </el-form>
                <el-button style="margin-left:70vw" @click="xianxiafilterCar_data_btn" type="primary">修改</el-button>


            </div>


        </el-dialog>
        <!-- 修改车辆 -->
        <el-dialog style="margin-top:5vh" v-model="up_car_off" title="修改订单车辆" width="80%" :close-on-click-modal='false'>
            <div>
                <el-form class="form_Css" :inline="true">
                    <el-form-item>
                        <div style="font-weight:700">订单起止日期:</div>
                    </el-form-item>
                    <el-form-item>
                        <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
                            v-model="up_car_data.stime" type="datetime" placeholder="开始日期" />

                    </el-form-item>
                    <el-form-item>
                        <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
                            v-model="up_car_data.etime" type="datetime" placeholder="结束日期" />
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 170px;" type="number" v-model="up_car_data.geSeats" placeholder="座位数"
                            clearable>

                            <template #append>座</template>
                        </el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 170px;" v-model="up_car_data.plateNum" placeholder="车牌号" clearable />
                    </el-form-item>
                    <!-- <el-form-item>
                      <el-input style="width: 170px;" v-model="up_car_data.orderNum" placeholder="订单号" clearable />
                  </el-form-item> -->

                    <el-form-item>
                        <el-select v-model="up_car_data.force" :placeholder="'强制查询'" style="width: 120px">
                            <el-option :label="'非强制'" value="0"></el-option>
                            <el-option :label="'强制查询(忽略时间冲突)'" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="up_car_find" type="primary">搜索</el-button>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="up_car_ok_btn" type="primary">确认设置</el-button>
                    </el-form-item>
                </el-form>
                <el-tag style="margin-bottom:10px;" type="primary">当钱车辆:{{ up_car_e.plateNum }}({{ up_car_e.needSeats ?
                    up_car_e.needSeats : '不限' + '人' }})</el-tag>

                <el-table @selection-change="up_car_selection_change_btn" :data="up_car_list" border fit :height="550"
                    style="width: 100%;margin-bottom: 20px;">
                    <el-table-column type="selection" width="35" />
                    <el-table-column label="编号" width="55" fixed type="index" />
                    <el-table-column width="120" property="seats" label="座位数" />

                    <el-table-column width="200" property="plateNum" label="车牌号">

                        <template #="{ row, column, $index }">
                            {{ row.plateNum }} <span v-if="row.isRestricted" style="color:Red">(限号)</span><br>

                        </template>
                    </el-table-column>
                    <el-table-column width="200" property="plateNum" label="驾驶员">

                        <template #="{ row, column, $index }">
                            {{ row.driverName ? row.driverName + '-' + row.driverPhone : '' }}

                        </template>
                    </el-table-column>


                </el-table>
            </div>
        </el-dialog>
        <!-- 修改驾驶员 -->
        <el-dialog style="margin-top:5vh" v-model="up_driver_off" title="修改订单驾驶员" width="80%"
            :close-on-click-modal='false'>
            <div>
                <el-form class="form_Css" :inline="true">
                    <el-form-item>
                        <div style="font-weight:700">订单起止日期:</div>
                    </el-form-item>
                    <el-form-item>
                        <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
                            v-model="up_driver_data.stime" type="datetime" placeholder="开始日期" />

                    </el-form-item>
                    <el-form-item>
                        <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
                            v-model="up_driver_data.etime" type="datetime" placeholder="结束日期" />
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 170px;" v-model="up_driver_data.driverInfo" placeholder="驾驶员姓名或电话"
                            clearable />
                    </el-form-item>

                    <el-form-item>
                        <el-input style="width: 170px;" v-model="up_driver_data.orderNum" placeholder="订单号" clearable />
                    </el-form-item>

                    <el-form-item>
                        <el-select v-model="up_driver_data.force" :placeholder="'强制查询'" style="width: 120px">
                            <el-option :label="'非强制'" value="0"></el-option>
                            <el-option :label="'强制查询(忽略时间冲突)'" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="up_driver_find" type="primary">搜索</el-button>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="up_driver_ok_btn" type="primary">确认设置</el-button>
                    </el-form-item>
                </el-form>
                <el-tag style="margin-bottom:10px;font-weight:700" type="primary">当前驾驶员:{{ up_driver_e.driverName }}-{{
                    up_driver_e.driverPhone }}</el-tag>

                <el-table @selection-change="up_driver_change_btn" :data="up_driver_list" border fit :height="550"
                    style="width: 100%;margin-bottom: 20px;">
                    <el-table-column type="selection" width="35" />
                    <el-table-column label="编号" width="55" fixed type="index" />
                    <el-table-column width="120" property="companyNum" label="单位编号" />
                    <el-table-column width="120" property="driverName" label="驾驶员" />
                    <el-table-column width="120" property="driverPhone" label="驾驶员电话" />
                    <el-table-column width="120" property="driveType" label="准驾车型" />
                    <el-table-column width="150" property="takeDriveTime" label="驾驶员证领证时间" />
                    <el-table-column width="150" property="takeDriveAddTime" label="驾驶证增驾时间" />
                    <el-table-column width="150" property="takeDriveExpireTime" label="驾驶证换证时间" />
                    <el-table-column width="150" property="certificateType" label="资格证证件类型" />
                    <el-table-column width="150" property="certificateDriveType" label="资格证准驾车型" />
                    <el-table-column width="120" property="certificateNum" label="资格证号" />
                    <el-table-column width="150" property="takeCertificateTime" label="资格证领证时间" />
                    <el-table-column width="150" property="certificateExpireTime" label="资格证换证时间" />
                </el-table>
            </div>

        </el-dialog>
    </div>
</template>

<script setup>
import Sortable from 'sortablejs';
import { GET_TOKEN } from '@/utils/token.js'
import { ref, reactive, onMounted, computed, watch } from 'vue'
import {
    getOrderGroupCarList, getPrivateSetList, adupPrivateSet, received, queryReceivedNoCar, findComboCusList, findCarCombo,
    getServiceMans, filterOrder, filterCar, offlineDispatchCar, mergeAndSendCar, mergeQuery, queryReceivedAndCar,
    changeUnder, changeDriver, findCanUseDriver, findCanUseCar, changeCar, cancelRelease, release, omsorderdelete, mergeQuerySend,
    merge, getCarConfigurationType, receiveOrRefuse, findTrusteeshipMeCombo

} from '@/api/original_order_list.js'
import { ElMessage, ElLoading, ElMessageBox } from 'element-plus'
import AMapLoader from "@amap/amap-jsapi-loader"
import { securityJsCode, key, importCusCheckInData } from '@/utils/common.js'
import * as XLSX from 'xlsx';
// import uporder from './up.vue'
import uporder from './up/index.vue'
import CircularJSON from 'circular-json'
onMounted(async () => {


    findTrusteeshipMeCombo({
        page: {
            pageNum: 1,
            pageSize: 999,
        },
        companyName: '',
    }).then(res => {
        let luser = JSON.parse(localStorage.getItem("luser"))
        let luser_companyNum = luser.companyNum
        let companyNums = [luser_companyNum]
        if (res.data) {
            for (let i = 0; i < res.data.length; i++) {
                console.log(res.data[i].companyNum)
                companyNums.push(res.data[i].companyNum)
            }
        }
        findCarCombo({
            page: {
                pageNum: 1,
                pageSize: 999,
            },
            plateNum: '',
            companyNums: companyNums,
        }).then(res => {

            carNumList.value = res.data.list || [];
        })
    })

    findComboCusList({
        page: {
            pageNum: 1,
            pageSize: 999,
        },

        cusTypeMark: 'CARTEAM',

    }).then(res => {
        findComboCusList_list.value = res.data
        findComboCusList_list2.value = res.data
    })
    getServiceMans({

    }).then(res => {
        if (res.code == 1) {
            getServiceMans_list.value = res.data;

        }
    })

    findComboCusList({
        page: {
            pageNum: 1,
            pageSize: 999,
        },



    }).then(res => {
        findComboCusList_list_yongche.value = res.data
        findComboCusList_list_yongche2.value = res.data
    })
    getPrivateSetList({
        find: '拼车列表',
        page: {
            pageNum: 1,
            pageSize: 100,
        },
    }).then(res => {
        if (res.data.list[0]) {
            table_data_list_new.value = JSON.parse(res.data.list[res.data.list.length - 1].dat)
        } else {

            table_data_list_new.value = table_data_list
        }
    })
    Sortable.create(sortableContainer.value, {
        draggable: '.drag_it',
        ghostClass: 'sortable-ghost',
        onEnd: evt => {
            const targetRow = table_data_list_new.value.splice(evt.oldIndex, 1)[0];
            table_data_list_new.value.splice(evt.newIndex, 0, targetRow);


        }
    })
    timeTypeTime.value = [new_day(), to_day()]
    find_data.stime = new_day()
    find_data.etime = to_day()
    if (tabs_activeName.value == '未接到') {
        list_api()
    } else if (tabs_activeName.value == '已接到') {
        list_api2()
    } else if (tabs_activeName.value == '已接到') {
        list_api3()
    }
})
//#region 修改
const up_off = ref(false)
const up_id = ref('')
const up_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }

    if (table_list.value[0].isTrusteeOrder == 1) {
        return ElMessageBox.confirm(
            '该订单是托管单位订单不能修改和删除',
            {
                confirmButtonText: '确认',
                // cancelButtonText: '取消',
                type: 'warning',
                showCancelButton: false,
                distinguishCancelAndClose: 'true',
            }
        )
            .then(() => {

            })
            .catch((e) => {


            })
    }

    up_id.value = table_list.value[0].id
    up_off.value = true
}
const upCarMd = (e) => {
    list_api()
    list_api2()
    list_api3()
    up_off.value = false
}


//#endregion
//#region 删除
const del_btn = () => {
    if (table_list.value.length < 1) {
        return ElMessage({
            message: '请选择数据！',
            type: 'warning',
        })
    }

    if (table_list.value[0].isTrusteeOrder == 1) {
        return ElMessageBox.confirm(
            '该订单是托管单位订单不能修改和删除',
            {
                confirmButtonText: '确认',
                // cancelButtonText: '取消',
                type: 'warning',
                showCancelButton: false,
                distinguishCancelAndClose: 'true',
            }
        )
            .then(() => {

            })
            .catch((e) => {


            })
    }

    ElMessageBox.confirm(
        '是否确认删除订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = []
            for (let i = 0; i < table_list.value.length; i++) {
                ps.push(table_list.value[i].id)
            }

            omsorderdelete({
                ids: ps
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    list_api2()
                    list_api3()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}
//#endregion
//#region 表格数据处理
const table_data_list = reactive([
    { label: '行程简称', field: 'routeSimpleName', width: 120, off: true, off2: true, off3: true },
    { label: '订单状态', field: 'status', width: 120, off: true, off2: true, off3: true },

    // { label: '车型', field: 'needSeats', width: 120, off: true },
    // { label: '台数', field: 'needSeats', width: 120, off: true },
    { label: '人数', field: 'personNum', width: 120, off: true, off2: true, off3: true },
    { label: '航班车次', field: 'flightNum', width: 120, off: true, off2: true, off3: true },
    { label: '已派车辆', field: 'plateNum', width: 120, off: true, off2: true, off3: true },
    { label: '驾驶员（电话）', field: 'driverName', width: 200, off: true, off2: true, off3: true },
    { label: '出发日期', field: 'startDate', width: 120, off: true, off2: true, off3: true },
    { label: '出发时间', field: 'startTime', width: 100, off: true, off2: true, off3: true },
    { label: '到达日期', field: 'endDate', width: 120, off: true, off2: true, off3: true },
    { label: '到达时间', field: 'endTime', width: 100, off: true, off2: true, off3: true },
    { label: '行程详情', field: 'details', width: 600, off: true, off2: true, off3: true },
    { label: '乘车人', field: 'cusName', width: 180, off: true, off2: true, off3: true },
    { label: '订单价格', field: 'price', width: 100, off: true, off2: true, off3: true },
    { label: '用车单位', field: 'useCarCompanyId', width: 220, off: true, off2: true, off3: true },
    { label: '用车负责人', field: 'useCarDutyInfo', width: 220, off: true, off2: true, off3: true },
    { label: '合并标记', field: 'isMerge', width: 100, off: true, off2: true, off3: false },
    { label: '客户备注', field: 'remark', width: 600, off: true, off2: true, off3: true },
    { label: '驾驶员备注', field: 'driverRemark', width: 700, off: true },
    { label: '业务员备注', field: 'serviceManRemark', width: 600, off: true, off2: true, off3: true },
    // { label: '乘车人', field: 'shareName', width: 160, off: true },
    { label: '业务员', field: 'persons', width: 160, off: true, off2: true, off3: true },
    { label: '订单号', field: 'orderNum', width: 120, off: true, off2: true, off3: true },
    { label: '添加时间', field: 'addTime', width: 170, off: true, off2: true, off3: true },



    // { label: '可等待时间', field: 'waitDate', width: 120, off: true },
    // { label: '起点', field: 'fromLocation', width: 220, off: true },
    // { label: '终点', field: 'toLocation', width: 220, off: true },

    // { label: '用车负责人', field: 'useCarName', width: 120, off: true },


])

const table_data_list_new = ref([])
const icon_off = ref(false)
// 创建排序容器的引用
const sortableContainer = ref('')

const icon_btn = () => {
    icon_off.value = !icon_off.value
    console.log(sortableContainer.value)

}
const resetTableSet = () => {
    table_data_list_new.value = JSON.parse(JSON.stringify(table_data_list))

}
const saveTableSet = () => {

    adupPrivateSet({
        dat: JSON.stringify(table_data_list_new.value),
        tbName: '拼车列表',
        tbNum: "carpool_list",
    }).then(res => {
        if (res.code == 1) {
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
    icon_off.value = false
}

const checkbox_btn = (e, c) => {
    for (let i = 0; i < table_data_list_new.value.length; i++) {
        if (table_data_list_new.value[i].label == c.target._value) {
            table_data_list_new.value[i].off == e

        }

    }

}

const sortedItems = computed(() => {
    return [...table_data_list_new.value].sort((a, b) => a.id - b.id);
})
//#endregion
// #region 非包车订单确认/拒绝接单
const receiveOrRefuse_btn = (e) => {
    ElMessageBox.confirm(
        '非包车订单确认/拒绝接单',
        {
            confirmButtonText: '确认接单',
            cancelButtonText: '拒绝接单',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = {
                id: e.id,
                isReceiveByTeam: 1,
            }
            receiveOrRefuse(ps).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {
            let ps = {
                id: e.id,
                isReceiveByTeam: 0,
            }
            receiveOrRefuse(ps).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })

        })
}

// #endregion

const tabs_activeName = ref('未接到')
// 行程简称
const routeSimpleName_list = reactive([

    {
        value: '拼车送天府',
        label: '拼车送天府',
    },
    {
        value: '拼车接天府',
        label: '拼车接天府',
    },
])
const handleClick = (tab, event) => {
    find_data.page.pageNum = 1
    find_data.page.pageSize = 100
    if (tab.props.name == '未接到') {
        tabs_activeName.value = '未接到'
        list_api()
    } else if (tab.props.name == '已接到') {
        tabs_activeName.value = '已接到'
        list_api2()
    } else if (tab.props.name == '已派车') {
        list_api3()
        tabs_activeName.value = '已派车'
    }
}
const new_day = () => {
    let today = new Date();

    let year = today.getFullYear();
    let month = today.getMonth() + 1; // 月份是从 0 到 11，所以需要加上 1
    let day = today.getDate();

    // 如果月份或日期小于 10，则在前面补零
    if (month < 10) {
        month = '0' + month;
    }

    if (day < 10) {
        day = '0' + day;
    }

    let formattedDate = `${year}-${month}-${day} 00:00:00`;
    return formattedDate
}
const to_day = () => {
    let today = new Date();
    let tomorrow = new Date(today);
    tomorrow.setDate(tomorrow.getDate() + 1);

    let year = tomorrow.getFullYear();
    let month = tomorrow.getMonth() + 1; // 月份是从 0 到 11，所以需要加上 1
    let day = tomorrow.getDate();

    // 如果月份或日期小于 10，则在前面补零
    if (month < 10) {
        month = '0' + month;
    }

    if (day < 10) {
        day = '0' + day;
    }

    let formattedDate = `${year}-${month}-${day} 23:59:59`;
    return formattedDate
}
const defaultTime = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]

const timeTypeTime = ref([])
const timeTypeTime_btn = (e) => {
    if (e) {
        timeTypeTime.value = e
        find_data.stime = timeTypeTime.value[0]
        find_data.etime = timeTypeTime.value[1]
    } else {
        timeTypeTime.value = ''
        find_data.stime = ''
        find_data.etime = ''
    }
}
const find_data = reactive({
    page: {
        pageNum: 1,
        pageSize: 100,
    },
    beReceived: 'false',
    follow: '',
    routeSimpleName: '拼车接天府',
    statusList: [],
    stime: '',
    etime: '',
    orderNum: '',
    details: '',

})
const total = ref([])
// 分页器一夜显示多少数据页面
const size_change_btn = () => {
    find_data.page.pageNum == 1
    if (tabs_activeName.value == '未接到') {
        list_api()
    } else if (tabs_activeName.value == '已接到') {
        list_api2()
    } else if (tabs_activeName.value == '已接到') {
        list_api3()
    }

}

// 分页器跳转页面
const current_change_btn = () => {
    if (tabs_activeName.value == '未接到') {
        list_api()
    } else if (tabs_activeName.value == '已接到') {
        list_api2()
    } else if (tabs_activeName.value == '已接到') {
        list_api3()
    }
}
const search_btn = () => {
    if (tabs_activeName.value == '未接到') {
        list_api()
    } else if (tabs_activeName.value == '已接到') {
        list_api2()
    } else if (tabs_activeName.value == '已派车') {
        list_api3()
    }
}
const getCarConfigurationType_list = ref([])
const getCarConfigurationType_btn = () => {
    let luser = JSON.parse(localStorage.getItem("luser"))
    let luser_companyNum = luser.companyNum
    filterCar_data.value.carConfig = ''
    getCarConfigurationType({
        stationListId: '',
        addWay: '',
        seats: filterCar_data.value.seats,
        companyNum: luser_companyNum,
        orderType: '0',
    }).then(res => {

        if (res.code == 1) {
            getCarConfigurationType_list.value = res.data
        } else {

            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
//#region 未接到
const release_btn = (e) => {
    ElMessageBox.confirm(
        '确认发布订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            release({ id: e.id }).then(res => {
                if (res.code == 1) {
                    list_api()
                    list_api2()
                    list_api3()

                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    list_api()
                    list_api2()
                    list_api3()
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}

const weijiedao_list = ref([])
const list_api = () => {
    const loading = ElLoading.service({
        lock: true,
        text: '正在加载，中请稍后...',
        background: 'rgba(0, 0, 0, 0.7)',
    })
    find_data.beReceived = false
    find_data.statusList = []
    getOrderGroupCarList(find_data).then(res => {
        loading.close()
        let index_no = 0
        for (let i = 0; i < res.data.list.length; i++) {
            if (index_no == 0 && res.data.list[i].mergeId == null) {
                res.data.list[i].index_off = true
            } else {
                res.data.list[i].index_off = false
            }
            if (res.data.list[i].mergeId == null) {
                index_no = 1
            }
        }
        weijiedao_list.value = res.data.list
        total.value = res.data.total
    })
}

const table_list = ref([])
const headerdragend = (newWidth, oldWidth, column) => {
    console.log(newWidth, oldWidth, column)
    for (let i = 0; i < table_data_list_new.value.length; i++) {
        if (column.property == table_data_list_new.value[i].field) {
            table_data_list_new.value[i].width = newWidth
        }
    }
}

const selection_change_btn = (e) => {
    table_list.value = e
    console.log(e)
}
const yijiedao_btn = () => {
    if (table_list.value.length < 1) {
        return ElMessage({
            message: '请选择数据！',
            type: 'warning',
        })
    }
    ElMessageBox.confirm(
        '是否是否已接到?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = []
            for (let i = 0; i < table_list.value.length; i++) {
                ps.push(table_list.value[i].id)
            }

            received({
                ids: ps
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}
//#endregion
const hebing_Btn_off = ref(false)
const hebing_Btn_data = ref([])
const hebing_Btn_list = ref([])
const hebing_Btn = (e) => {
    hebing_Btn_data.value = []
    hebing_Btn_data.value.push(e)
    let ps = {
        id: e.id,
        notContainOrderId: [e.id],
    }
    mergeQuerySend(ps).then(res => {
        if (res.code == 1) {
            hebing_Btn_list.value = res.data
        } else {

            ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
    hebing_Btn_off.value = true
}
const startTime_btn = (e) => {
    hebing_Btn_data_time.value = e
}
const hebing_Btn_list_btn = (e) => {
    if (hebing_Btn_data.value.length > 5) {
        return ElMessage({
            message: '最多合并5个订单',
            type: 'warning',
        })
    }
    hebing_Btn_data.value.push(e)
    let ps = {
        id: hebing_Btn_data.value[0].id,
        notContainOrderId: [],
    }
    for (let i = 0; i < hebing_Btn_data.value.length; i++) {
        ps.notContainOrderId.push(hebing_Btn_data.value[i].id)
        if (hebing_Btn_data_time.value) {
            let time1 = new Date(hebing_Btn_data_time.value).getTime()
            let time2 = new Date(hebing_Btn_data.value[i].startTime).getTime()
            if (time1 > time2) {
                hebing_Btn_data_time.value = hebing_Btn_data.value[i].startTime
            }

        } else {
            hebing_Btn_data_time.value = hebing_Btn_data.value[i].startTime
        }
    }


    mergeQuerySend(ps).then(res => {
        if (res.code == 1) {
            hebing_Btn_list.value = res.data
        } else {
            hebing_Btn_list.value = []
            ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const innerVisible = ref(false)
const innerVisible_btn = () => {
    if (hebing_Btn_data.value.length < 2) {
        return ElMessage({
            message: '请选择最少两个订单',
            type: 'warning',
        })
    }
    hebing_Btn_data_time.value = ''
    for (let i = 0; i < hebing_Btn_data.value.length; i++) {

        if (hebing_Btn_data_time.value) {
            let time1 = new Date(hebing_Btn_data_time.value).getTime()
            let time2 = new Date(hebing_Btn_data.value[i].startTime).getTime()
            if (time1 > time2) {
                hebing_Btn_data_time.value = hebing_Btn_data.value[i].startTime
            }

        } else {
            hebing_Btn_data_time.value = hebing_Btn_data.value[i].startTime
        }
    }
    innerVisible.value = true
}
const hebing_Btn_data_time = ref('')
const time_number1 = ref('')
const time_number_change1 = (e) => {
    // add_data.landDate转换
    if (!hebing_Btn_data_time.value) {
        time_number1.value = ''
        return ElMessage({
            message: '请先选择日期',
            type: 'warning',
        })
    } else if (time_number1.value.length != 4) {
        time_number1.value = ''
        return ElMessage({
            message: '时间格式不对，列12:01请输入1201',
            type: 'warning',
        })
    } else if (time_number1.value[0] > 2) {
        time_number1.value = ''
        return ElMessage({
            message: '时间格式不对，首数字不能大于2',
            type: 'warning',
        })
    } else if (time_number1.value[0] == 2) {
        if (time_number1.value[1] > 4) {
            time_number1.value = ''
            return ElMessage({
                message: '时间格式不对，列12:01请输入1201',
                type: 'warning',
            })
        }

    }
    let datetime1 = hebing_Btn_data_time.value.split(' ')[0]
    let datetime2 = time_number1.value[0] + time_number1.value[1] + ':' + time_number1.value[2] + time_number1.value[3] + ':00'
    hebing_Btn_data_time.value = datetime1 + ' ' + datetime2
    time_number1.value = ''
    console.log(hebing_Btn_data_time.value)
}

const ok_over_btn = () => {


    ElMessageBox.confirm(
        '是否确认合并订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = {
                ids: [],
                startTime: '',
            }
            for (let i = 0; i < hebing_Btn_data.value.length; i++) {
                ps.ids.push(hebing_Btn_data.value[i].id)
                // if (ps.startTime) {
                //     let time1 = new Date(ps.startTime).getTime()
                //     let time2 = new Date(hebing_Btn_data.value[i].startTime).getTime()
                //     if (time1 > time2) {
                //         ps.startTime = hebing_Btn_data.value[i].startTime
                //     }

                // } else {
                //     ps.startTime = hebing_Btn_data.value[i].startTime
                // }

            }
            ps.startTime = hebing_Btn_data_time.value

            merge(ps).then(res => {
                if (res.code == 1) {
                    list_api()
                    innerVisible.value = false
                    hebing_Btn_off.value = false


                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {

                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })


        })
        .catch((e) => {


        })
}
//#region 已接到
const yijiedao_list = ref([])
const list_api2 = () => {
    find_data.beReceived = true
    find_data.statusList = ['READY_CAR']
    getOrderGroupCarList(find_data).then(res => {
        let index_no = 0
        for (let i = 0; i < res.data.list.length; i++) {
            if (index_no == 0 && res.data.list[i].mergeId == null) {
                res.data.list[i].index_off = true
            } else {
                res.data.list[i].index_off = false
            }
            if (res.data.list[i].mergeId == null) {
                index_no = 1
            }
        }
        yijiedao_list.value = res.data.list
        total.value = res.data.total
    })
}
const table_list2 = ref([])
const selection_change_btn2 = (e) => {
    table_list2.value = e
    console.log(e)
}


// #region 派车
const carNumList = ref([])
const activeName = ref('线上派车')
const handleClick2 = (e, x) => {
    console.log(e.props.name)
}

const vehicles_off = ref(false)
const vehicles_data = ref({})
const vehicles_btn = (e) => {
    vehicles_data.value = e
    console.log(e)
    filterCar_data.value.ids = [e.id]
    filterCar_data.value.seats = e.needSeats <= 5 ? '7' : e.needSeats

    filterCar_data.value.startTime = e.startTime
    let luser = JSON.parse(localStorage.getItem("luser"))
    let luser_companyNum = luser.companyNum

    getCarConfigurationType({
        stationListId: '',
        addWay: '',
        seats: filterCar_data.value.seats,
        companyNum: luser_companyNum,
        orderType: '0',
    }).then(res => {

        if (res.code == 1) {
            getCarConfigurationType_list.value = res.data
            filterCar_data.value.carConfig = ''
        } else {

            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })


    // dispatchCarPop_api()

    filterOrder_data.value.id = vehicles_data.value.id
    filterOrder_data_radio.value = 2
    filterOrder_data_radio2.value = 5

    filterOrder_data.value.startPoint = false
    filterOrder_data.value.endPoint = true
    filterOrder_data.value.best = false
    filterOrder_data.value.intervalTimeAsc = false
    filterOrder_data.value.routeTimeAsc = true
    filterOrder_data.value.overlapTime = '10'
    filterOrder_data.value.avgSpeed = '40'
    filterOrder_data.value.time = '6'
    filterOrder_data.value.stime = vehicles_data.value.endTime
    filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)

    offlineDispatchCar_data.value.carCompanyId = ''
    offlineDispatchCar_data.value.dispatchMobile = ''
    offlineDispatchCar_data.value.dispatchName = ''
    offlineDispatchCar_data.value.driverName = ''
    offlineDispatchCar_data.value.driverPhone = ''
    offlineDispatchCar_data.value.ids = ''
    offlineDispatchCar_data.value.outPrice = ''
    offlineDispatchCar_data.value.plateNum = ''
    offlineDispatchCar_data.value.carDutyUserId = ''
    set_list.value = []


    activeName.value = '线上派车'
    filterOrder_api()
    filterCar_api()
    vehicles_off.value = true
}
const vehiclesBtn = () => {
    vehicles_off.value = false
}
const filterCar_list = ref([])
const filterCar_data = ref({
    ids: [],
    startPoint: '',
    endPoint: '',
    best: '',
    seats: '7',
    plateNum: '',
    driverUserIdIsNull: '1',
    fastCondition: '2',
    startTime: '',
    carConfig: '',
})
const filterCar_api = () => {
    if (filterCar_data.value.seats == '不限车型') {
        filterCar_data.value.seats = 0
    }
    // 套接
    filterCar_data.value.startPoint = false
    filterCar_data.value.endPoint = false
    filterCar_data.value.best = false
    filterCar(filterCar_data.value).then(res => {
        if (filterCar_data.value.seats == 0) {
            filterCar_data.value.seats = '不限车型'
        }
        if (res.code == 1) {
            filterCar_list.value = res.data
        }
    })
}
const findComboCusList_list = ref([])
const findComboCusList_list2 = ref([])
const getServiceMans_list = ref([])
const findComboCusList_list_yongche = ref([])
const findComboCusList_list_yongche2 = ref([])
const dispatchCarPop_api = () => {
    dispatchCarPop({
        id: vehicles_data.value.id
    }).then(res => {
        if (res.code == 1) {
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const filterCar_data_find = () => {

    filterCar_api()
}
// 智能派车



const filterCar_data_ok_btn = (e) => {

    ElMessageBox.confirm(
        '是否确认派车?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ids = [vehicles_data.value.id]
            // for (let i = 0; i < set_list.value.length; i++) {
            //     ids.push(set_list.value[i].id)
            // }

            let cancelorderId = []
            if (e.orderId) {
                cancelorderId.push(e.orderId)
            }
            if (e.lastOrderId) {
                cancelorderId.push(e.lastOrderId)
            }
            let ps = {
                orderId: ids.join(','),
                plateNum: e.plateNum,
                driverUserId: e.driverUserId,
                cancelNum: '',
                sendPrice: '',
                cancelorderId: cancelorderId.join(','),
            }
            mergeAndSendCar({
                type: 0,
                ids: ids,
                sendInfo: [ps],
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    list_api2()
                    list_api3()
                    vehicles_off.value = false
                    hebing_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })


        })
        .catch((e) => {


        })
}
const filterOrder_table_list = ref([])
const filterOrder_selection_change_btn = (e) => {
    filterOrder_table_list.value = e
    console.log(filterOrder_table_list.value)
    let ids = [vehicles_data.value.id]

    for (let i = 0; i < e.length; i++) {
        ids.push(e[i].id)
    }
    filterCar_data.value.ids = ids
}
const filterOrder_data_change = () => {
    if (filterOrder_data.value.time == '12') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '24') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '48') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '6') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
        }
    }
}
const filterOrder_data_find = () => {
    filterOrder_api()
}
const useCarCompanyId_data_api = (e) => {
    let data = ''
    if (e.isCompanyCustomer == 1) {
        if (e.virtuallyUseCarInfo) {
            let data2 = ''
            if (e.useCarCompanyName) {
                data2 = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
            } else {
                data2 = e.realName ? e.realName : '匿名'
            }
            data = e.virtuallyUseCarInfo.split('-')[0] + '【' + data2 + '】'
        } else {

            if (e.useCarCompanyName) {
                data = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
            } else {
                data = e.realName ? e.realName : '匿名'
            }

        }
    } else if (e.isCompanyCustomer == 0 && e.companyNum == '8112010001') {
        if (e.virtuallyUseCarInfo) {
            let data2 = ''
            if (e.useCarCompanyName) {
                data2 = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
            } else {
                data2 = e.realName ? e.realName : '匿名'
            }
            data = e.virtuallyUseCarInfo.split('-')[0] + '【' + data2 + '】'
        } else {

            if (e.useCarCompanyName) {
                data = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
            } else {
                data = e.realName ? e.realName : '匿名'
            }

        }
    } else if (e.isCompanyCustomer == 0 && e.companyNum != '8112010001') {
        data = e.virtuallyUseCarInfo.split('-')[0] ? e.virtuallyUseCarInfo : '匿名'
    }


    return data
}
const useCarDutyInfo_data_api = (e) => {
    let data = ''
    if (e.isCompanyCustomer == 1) {

        if (e.virtuallyUseCarInfo) {
            let realName = e.realName ? e.realName : '匿名'
            let mobile = e.mobile ? e.mobile : ''
            data = e.virtuallyUseCarInfo.split('-')[0] + '(' + e.useCarDutyInfo + ')'
        } else {
            let realName = e.realName ? e.realName : '匿名'
            let mobile = e.mobile ? e.mobile : ''
            data = e.useCarDutyInfo
        }

    } else if (e.isCompanyCustomer == 0 && e.companyNum == '8112010001') {

        if (e.virtuallyUseCarInfo) {
            let realName = e.realName ? e.realName : '匿名'
            let mobile = e.mobile ? e.mobile : ''
            data = e.virtuallyUseCarInfo.split('-')[0] + '(' + e.useCarDutyInfo + ')'
        } else {
            let realName = e.realName ? e.realName : '匿名'
            let mobile = e.mobile ? e.mobile : ''
            data = e.useCarDutyInfo
        }
    } else if (e.isCompanyCustomer == 0 && e.companyNum != '8112010001') {
        data = e.virtuallyUseCarInfo ? e.virtuallyUseCarInfo.split('-')[0] : '匿名'
    }


    return data


}

const filterOrder_data_radio = ref(2)
const filterOrder_data_radio_change = () => {
    if (filterOrder_data.value.time == '12') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '24') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '48') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '6') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
        }
    }
}
const filterOrder_data_radio2 = ref(5)
const filterOrder_data = ref({
    id: '',
    startPoint: true,
    endPoint: false,
    stime: '',
    etime: '',
    best: false,
    avgSpeed: '40',
    overlapTime: '10',
    intervalTimeAsc: false,
    routeTimeAsc: true,
    notContainOrderId: [],
    time: '6',
})
const filterOrder_list = ref([])
const filterOrder_api = () => {


    if (filterOrder_data_radio.value == 1) {
        // 起点
        filterOrder_data.value.startPoint = true
        filterOrder_data.value.endPoint = false
        filterOrder_data.value.best = false
    } else if (filterOrder_data_radio.value == 2) {
        // 终点
        filterOrder_data.value.startPoint = false
        filterOrder_data.value.endPoint = true
        filterOrder_data.value.best = false
    } else if (filterOrder_data_radio.value == 3) {
        // 套接
        filterOrder_data.value.startPoint = false
        filterOrder_data.value.endPoint = false
        filterOrder_data.value.best = true
    }
    if (filterOrder_data_radio2.value == 4) {
        filterOrder_data.value.intervalTimeAsc = true
        filterOrder_data.value.routeTimeAsc = false
    } else if (filterOrder_data_radio2.value == 5) {
        filterOrder_data.value.intervalTimeAsc = false
        filterOrder_data.value.routeTimeAsc = true
    }
    if (set_list.value.length > 0) {
        filterOrder_data.value.notContainOrderId = [vehicles_data.value.id]
        for (let i = 0; i < set_list.value.length; i++) {

            filterOrder_data.value.notContainOrderId.push(set_list.value[i].id)
        }
    } else {
        filterOrder_data.value.notContainOrderId = [vehicles_data.value.id]
    }
    if (set_list.value.length > 0) {
        filterOrder_data.value.id = set_list.value[set_list.value.length - 1].id

    } else {
        filterOrder_data.value.id = vehicles_data.value.id

    }
    filterOrder(filterOrder_data.value).then(res => {
        if (res.code == 1) {
            filterOrder_list.value = res.data
        } else {
            filterOrder_list.value = res.data
        }
    })
}
const hover6 = (e, x) => {
    let currentDate = new Date(e);
    let pastDate = ''
    if (x == 0) {
        pastDate = new Date(currentDate.getTime() - 6 * 60 * 60 * 1000); // 24小时前的时间
    } else {
        pastDate = new Date(currentDate.getTime() + 6 * 60 * 60 * 1000); // 24小时前的时间
    }

    console.log(x)
    let year = pastDate.getFullYear();
    let month = String(pastDate.getMonth() + 1).padStart(2, '0');
    let day = String(pastDate.getDate()).padStart(2, '0');
    let hours = String(pastDate.getHours()).padStart(2, '0');
    let minutes = String(pastDate.getMinutes()).padStart(2, '0');
    let seconds = String(pastDate.getSeconds()).padStart(2, '0');
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
const hover12 = (e, x) => {
    let currentDate = new Date(e);
    let pastDate = ''
    if (x == 0) {
        pastDate = new Date(currentDate.getTime() - 12 * 60 * 60 * 1000); // 24小时前的时间
    } else {
        pastDate = new Date(currentDate.getTime() + 12 * 60 * 60 * 1000); // 24小时前的时间
    }

    console.log(x)
    let year = pastDate.getFullYear();
    let month = String(pastDate.getMonth() + 1).padStart(2, '0');
    let day = String(pastDate.getDate()).padStart(2, '0');
    let hours = String(pastDate.getHours()).padStart(2, '0');
    let minutes = String(pastDate.getMinutes()).padStart(2, '0');
    let seconds = String(pastDate.getSeconds()).padStart(2, '0');
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
const hover24 = (e, x) => {
    let currentDate = new Date(e);
    let pastDate = ''
    if (x == 0) {
        pastDate = new Date(currentDate.getTime() - 24 * 60 * 60 * 1000); // 24小时前的时间
    } else {
        pastDate = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000); // 24小时前的时间
    }


    let year = pastDate.getFullYear();
    let month = String(pastDate.getMonth() + 1).padStart(2, '0');
    let day = String(pastDate.getDate()).padStart(2, '0');
    let hours = String(pastDate.getHours()).padStart(2, '0');
    let minutes = String(pastDate.getMinutes()).padStart(2, '0');
    let seconds = String(pastDate.getSeconds()).padStart(2, '0');
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
const hover48 = (e, x) => {
    let currentDate = new Date(e);
    let pastDate = ''
    if (x == 0) {
        pastDate = new Date(currentDate.getTime() - 48 * 60 * 60 * 1000); // 24小时前的时间
    } else {
        pastDate = new Date(currentDate.getTime() + 48 * 60 * 60 * 1000); // 24小时前的时间
    }


    let year = pastDate.getFullYear();
    let month = String(pastDate.getMonth() + 1).padStart(2, '0');
    let day = String(pastDate.getDate()).padStart(2, '0');
    let hours = String(pastDate.getHours()).padStart(2, '0');
    let minutes = String(pastDate.getMinutes()).padStart(2, '0');
    let seconds = String(pastDate.getSeconds()).padStart(2, '0');
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
// 线下派车
// CARTEAM
const offlineDispatchCar_data = ref({
    carCompanyId: '',
    dispatchMobile: '',
    dispatchName: '',
    driverName: '',
    driverPhone: "",
    ids: '',
    outPrice: '',
    plateNum: '',
    carDutyUserId: '',
})
const carCompanyId_change = () => {
    for (let i = 0; i < findComboCusList_list.value.length; i++) {

        if (offlineDispatchCar_data.value.carCompanyId == findComboCusList_list.value[i].id) {
            offlineDispatchCar_data.value.carDutyUserId = findComboCusList_list.value[i].userId
            offlineDispatchCar_data.value.dispatchMobile = findComboCusList_list.value[i].cusPhone
            offlineDispatchCar_data.value.dispatchName = findComboCusList_list.value[i].cusRealName
        }
    }
}

const handleFilter = (value) => {
    // 自定义筛选逻辑
    if (value) {
        let results = findComboCusList_list2.value.filter(item => {
            for (let key in item) {
                if (typeof item[key] === 'string' && item[key].includes(value)) {
                    return true;
                }
            }
            return false;
        })
        if (results.length > 0) {
            findComboCusList_list.value = results
        } else {
            findComboCusList_list.value = []
        }
    } else {
        findComboCusList_list.value = findComboCusList_list2.value
    }
}

const offlineDispatchCar_ref = ref('')
const filterCar_data_btn = () => {
    offlineDispatchCar_data.value.ids = [vehicles_data.value.id]
    offlineDispatchCar_ref.value.validate((valid) => {
        if (!valid) {
            return false;
        } else {
            offlineDispatchCar(offlineDispatchCar_data.value).then(res => {
                if (res.code == 1) {
                    list_api()
                    vehicles_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        }
    })

}
// #endregion
//#region 合并订单
const hebing_off = ref(false)
const hebing_obj = ref({})
const hebing_list = ref([])

const no_release_btn = (e) => {
    ElMessageBox.confirm(
        '取消发布订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            cancelRelease({ id: e.id }).then(res => {
                if (res.code == 1) {
                    list_api()
                    list_api2()
                    list_api3()

                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    list_api()
                    list_api2()
                    list_api3()
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })
}
// const hebing_Btn = (e) => {
//     hebing_obj.value = e
//     // mergeQuery_api()
//     hebing_car_data.value.startTime =e.startTime
//     hebing_car_data.value.ids = [e.id]
//     hebing_car_data.value.seats = e.needSeats ? e.needSeats : '不限车型'
//     hebing_off.value = true
// }
const mergeQuery_api = () => {
    let id = hebing_obj.value.id
    let notContainOrderId = []
    notContainOrderId.push(hebing_obj.value.id)
    for (let i = 0; i < set_list.value.length; i++) {
        notContainOrderId.push(set_list.value[i].id)
    }
    let ps = {
        id: id,
        notContainOrderId: notContainOrderId,
    }
    mergeQuery(ps).then(res => {
        if (res.code == 1) {
            hebing_list.value = res.data

        } else {
            hebing_list.value = []
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const set_btn = (e) => {
    set_list.value.push(e)

    mergeQuery_api()
    console.log(set_list.value)
}
const set_list = ref([])

const set_over_btn = (e) => {
    for (let i = 0; i < hebing_Btn_data.value.length; i++) {
        if (e.id == hebing_Btn_data.value[i].id) {
            hebing_Btn_data.value.splice(i, 1); // 删除一个元素
        }
    }
    let ps = {
        id: hebing_Btn_data.value[0].id,
        notContainOrderId: [],
    }
    for (let i = 0; i < hebing_Btn_data.value.length; i++) {
        ps.notContainOrderId.push(hebing_Btn_data.value[i].id)
    }
    mergeQuerySend(ps).then(res => {
        if (res.code == 1) {
            hebing_Btn_list.value = res.data
        } else {
            hebing_Btn_list.value = []
            ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
// const set_over_btn = (e) => {
//     console.log(e)
//     for (let i = 0; i < set_list.value.length; i++) {
//         if (e.id == set_list.value[i].id) {
//             set_list.value.splice(i, 1); // 删除一个元素
//         }
//     }
//     mergeQuery_api()
//     hebing_car_api()

// }
const hebing_car_list = ref([])
const hebing_car_data = ref({
    ids: [],
    startPoint: '',
    endPoint: '',
    best: '',
    seats: '7',
    plateNum: '',
    driverUserIdIsNull: '1',
    fastCondition: '2',
    startTime: '',

})
const hebing_car_api = () => {
    if (hebing_car_data.value.seats == '不限车型') {
        hebing_car_data.value.seats = 0
    }
    // 套接
    hebing_car_data.value.startPoint = false
    hebing_car_data.value.endPoint = false
    hebing_car_data.value.best = false
    hebing_car_data.value.ids = []

    hebing_car_data.value.ids.push(hebing_obj.value.id)
    for (let i = 0; i < set_list.value.length; i++) {
        hebing_car_data.value.ids.push(set_list.value[i].id)
    }
    filterCar(hebing_car_data.value).then(res => {
        if (hebing_car_data.value.seats == 0) {
            hebing_car_data.value.seats = '不限车型'
        }
        if (res.code == 1) {
            hebing_car_list.value = res.data
        }
    })
}
const hebing_car_data_ok_btn = (e) => {

    ElMessageBox.confirm(
        '是否确认派车?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ids = [hebing_obj.value.id]
            for (let i = 0; i < set_list.value.length; i++) {
                ids.push(set_list.value[i].id)
            }
            let ps = {
                orderId: ids.join(','),
                plateNum: e.plateNum,
                driverUserId: e.driverUserId,
                cancelNum: '',
                sendPrice: '',
            }
            mergeAndSendCar({
                type: 0,
                ids: ids,
                sendInfo: [ps],
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    list_api2()
                    list_api3()
                    vehicles_off.value = false
                    hebing_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })


        })
        .catch((e) => {


        })
}

//#endregion

//#region 已派车
const yipaiche_list = ref([])
const list_api3 = () => {
    let ps = JSON.parse(JSON.stringify(find_data))
    ps.beReceived = true
    ps.statusList = ['DRIVER_READY_RECEIVE', 'DRIVER_CONFIRMED', 'START_TAKE_CUS', 'ON_ROADING', 'FINISHED']

    getOrderGroupCarList(ps).then(res => {
        let index_no = 0
        for (let i = 0; i < res.data.list.length; i++) {
            if (index_no == 0 && res.data.list[i].mergeId == null) {
                res.data.list[i].index_off = true
            } else {
                res.data.list[i].index_off = false
            }
            if (res.data.list[i].mergeId == null) {
                index_no = 1
            }
        }
        yipaiche_list.value = res.data.list
        total.value = res.data.total
    })
}

const table_list3 = ref([])
const selection_change_btn3 = (e) => {
    table_list3.value = e
    console.log(e)
}
//#region 修改车辆  
const up_car_off = ref(false)
const up_car_e = ref({})
const up_car_list = ref([])
const up_car_data = reactive({
    stime: '',
    etime: '',
    force: "0",
    geSeats: '',
    orderNum: '',
    plateNum: '',
})
const findCanUseCar_api = () => {
    findCanUseCar(up_car_data).then(res => {
        if (res.code == 1) {
            up_car_list.value = res.data.cars
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const up_car = (e) => {
    console.log(e)
    if (e.carCompanyId) {
        xianxiaup_car_data.carCompanyId = e.carCompanyId
        xianxiaup_car_data.carDutyUserId = e.carDutyUserId
        xianxiaup_car_data.id = e.id
        xianxiaup_car_data.driverPhone = e.driverPhone
        // xianxiaup_car_data.outPrice = e.outPrice
        xianxiaup_car_data.driverName = e.driverName
        xianxiaup_car_data.dispatchName = e.dispatchName
        xianxiaup_car_data.dispatchMobile = e.dispatchMobile
        xianxiaup_car_data.plateNum = e.plateNum
        for (let i = 0; i < findComboCusList_list.value.length; i++) {

            if (xianxiaup_car_data.carCompanyId == findComboCusList_list.value[i].id) {
                xianxiaup_car_data.carDutyUserId = findComboCusList_list.value[i].userId
                xianxiaup_car_data.dispatchMobile = findComboCusList_list.value[i].cusPhone
                xianxiaup_car_data.dispatchName = findComboCusList_list.value[i].cusRealName
            }
        }
        xianxiaup_car_off.value = true
    } else {
        up_car_data.stime = e.startTime
        up_car_data.etime = e.endTime
        up_car_data.force = '0'
        up_car_data.geSeats = e.needSeats ? e.needSeats : e.personNum + 1
        up_car_data.orderNum = e.orderNum
        up_car_data.plateNum = ''
        up_car_e.value = e
        console.log(up_car_e.value)
        findCanUseCar_api()
        up_car_off.value = true
    }
}
const up_car_find = () => {
    findCanUseCar_api()
}
const up_car_selection_change_list = ref([])

const up_car_selection_change_btn = (e) => {
    console.log(e)
    up_car_selection_change_list.value = e
}
const up_car_ok_btn = () => {
    if (up_car_selection_change_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    ElMessageBox.confirm(
        '确认修改车辆?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            changeCar({
                id: up_car_e.value.id,
                plateNum: up_car_selection_change_list.value[0].plateNum,
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    up_car_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}
//#endregion

//#region 修改车驾驶员
const up_driver_off = ref(false)
const up_driver_e = ref({})
const up_driver_list = ref([])
const up_driver_data = reactive({
    stime: '',
    etime: '',
    driverInfo: "",
    force: '0',
    orderNum: '',
})
const up_driver_api = () => {
    findCanUseDriver(up_driver_data).then(res => {
        up_driver_list.value = res.data.drivers
    })
}
const xianxiaup_car_off = ref(false)
const xianxiaup_car_data = reactive({
    carCompanyId: '',
    carDutyUserId: '',
    id: '',
    driverPhone: '',
    driverName: '',
    dispatchName: '',
    dispatchMobile: '',
    plateNum: '',
    outPrice: '',
})
const xianxiacarCompanyId_change = () => {
    for (let i = 0; i < findComboCusList_list.value.length; i++) {

        if (xianxiaup_car_data.carCompanyId == findComboCusList_list.value[i].id) {
            xianxiaup_car_data.carDutyUserId = findComboCusList_list.value[i].userId
            xianxiaup_car_data.dispatchMobile = findComboCusList_list.value[i].cusPhone
            xianxiaup_car_data.dispatchName = findComboCusList_list.value[i].cusRealName
        }
    }
}
const xianxiafilterCar_data_btn = () => {
    changeUnder(xianxiaup_car_data).then(res => {
        if (res.code == 1) {
            list_api()
            xianxiaup_car_off.value = false
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const up_driverName = (e) => {

    if (e.carCompanyId) {
        xianxiaup_car_data.carCompanyId = e.carCompanyId
        xianxiaup_car_data.carDutyUserId = e.carDutyUserId
        xianxiaup_car_data.id = e.id
        xianxiaup_car_data.driverPhone = e.driverPhone
        xianxiaup_car_data.driverName = e.driverName
        // xianxiaup_car_data.outPrice = e.outPrice
        xianxiaup_car_data.dispatchName = e.dispatchName
        xianxiaup_car_data.dispatchMobile = e.dispatchMobile
        xianxiaup_car_data.plateNum = e.plateNum
        for (let i = 0; i < findComboCusList_list.value.length; i++) {

            if (xianxiaup_car_data.carCompanyId == findComboCusList_list.value[i].id) {
                xianxiaup_car_data.carDutyUserId = findComboCusList_list.value[i].userId
                xianxiaup_car_data.dispatchMobile = findComboCusList_list.value[i].cusPhone
                xianxiaup_car_data.dispatchName = findComboCusList_list.value[i].cusRealName
            }
        }
        xianxiaup_car_off.value = true
    } else {
        up_driver_data.stime = e.startTime
        up_driver_data.etime = e.endTime
        up_driver_data.force = '0'
        up_driver_data.orderNum = ''
        up_driver_data.driverInfo = ''
        up_driver_e.value = e
        console.log(up_driver_e.value)
        up_driver_api()
        up_driver_off.value = true
    }

}
const up_driver_find = () => {
    up_driver_api()
}
const up_driver_change_list = ref([])
const up_driver_change_btn = (e) => {
    up_driver_change_list.value = e
}
const up_driver_ok_btn = () => {
    if (up_driver_change_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    let ps = {
        driverName: up_driver_change_list.value[0].driverName,
        driverPhone: up_driver_change_list.value[0].driverPhone,
        driverUserId: up_driver_change_list.value[0].userId,
        id: up_driver_e.value.id,
    }

    ElMessageBox.confirm(
        '确认修改驾驶员?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            changeDriver(ps).then(res => {
                if (res.code == 1) {
                    list_api()
                    up_driver_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })





}

//#endregion

//#endregion

</script>

<style scoped lang='scss'>
.form_Css>.el-form-item {
    margin-right: 10px !important;
}

.div_map {
    position: relative;
    left: 0;
    top: 0;
}

.map_input {
    width: 100%;
    position: absolute;
    z-index: 1;
    display: flex;
    justify-content: center;

}

.map_input2 {
    width: 100%;
    position: absolute;
    z-index: 1;
    display: flex;
    justify-content: center;
    top: 34px;

}

.div_bg:hover {


    background-color: darkgray;
}
</style>

<style>
.el-table .el-table__cell {
    padding: 0px !important;
}



#tab-aircraft_deliver {
    color: red;
}

#tab-train_deliver {
    color: red;
}

#tab-bus_deliver {
    color: red;
}

.col-items::-webkit-scrollbar {
    width: 5px !important;
}

.col-items>label {
    margin-left: 0px !important;
    margin-top: 5px;
    width: 100%;
}
</style>
